package cc.javaee.bbs.vo;

import cc.javaee.bbs.model.activity.KbrActivity;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;

/**
 * @author xdw
 */
@Data
public class ActivityVO {

    //活动ID
    private Integer id;

    // 活动名称
    private String name;

    //活动类型 1大侠赛事 2企业活动
    private String type;

    //活动图片地址
    private String imgPath;

    //参与人数
    private Integer participants;

    //状态 0 未开始 1正在进行 2，3 已结束
    private Integer status;

    //我的状态 1已参与， 0未参与
    private Integer myStatus;

    //距离开始还有多少天
    private Integer beforeStart;

    //距离结束还有多少天
    private Integer beforeEnd;

    public static ActivityVO convertKbrActivity(KbrActivity activity) {
        ActivityVO vo = new ActivityVO();
        vo.setId(activity.getId());
        vo.setName(activity.getName());
        vo.setType(activity.getType());
        if (CollectionUtils.isNotEmpty(activity.getActFileList())) {
            vo.setImgPath(activity.getActFileList().get(0).getFilePath());
        }
        vo.setParticipants(activity.getAlreadyCount());
        vo.setStatus(activity.getStatus());
        vo.setMyStatus(0);
        vo.setBeforeStart(3);
        vo.setBeforeEnd(10);
        return vo;
    }

}
